import sys
#!{sys.executable} -m pip install
#!conda install --yes --prefix {sys.prefix}
sys.path.append('../')
from ISI import Problem, Solution, excel_to_pb, Meta_param, Matheuristic
import numpy as np
from copy import deepcopy
path = '../Data/Burundi final v2.xlsx'
schools, warehouses, Q1, V_number, makes = excel_to_pb(path)
problem_global = Problem(warehouses, schools, Q1, V_number=V_number, makes=makes, T=2, H=1, time_step=0.5)
problem_global.time_fuse()
problems = problem_global.clustering()
problemBUJUMBURA,problemNGOZI,problemGITEGA = problems[0], problems[1], problems[2]
param = Meta_param(seed = 1)
problem = problemNGOZI
problem1 = problem.copy()
problem1
param
heuristic1 = Matheuristic(problem1,param)
heuristic1.algo2()
heuristic1.plot_steps()
heuristic1.solution_best
problem2 = problem.copy()
problem2.augment_v(2)
problem2
param
heuristic2 = Matheuristic(problem2,param)
heuristic2.algo2()
heuristic2.plot_steps()
heuristic2.solution_best
problem3 = problem.copy()
problem3.H = 2
problem3
param
heuristic3 = Matheuristic(problem3,param)
heuristic3.algo2()
heuristic3.plot_steps()
heuristic3.solution_best
problem4 = problem.copy()
problem4.t_virt = 0
problem4.time_fuse(1/problem.t_virt)
problem4
param
heuristic4 = Matheuristic(problem4,param)
heuristic4.algo2()
heuristic4.plot_steps()
heuristic4.solution_best
problem5 = problem.copy()
problem5
param5 = deepcopy(param)
param5.rho_percent = 0.6
heuristic5 = Matheuristic(problem5,param5)
heuristic5.algo2()
heuristic5.plot_steps()
heuristic5.solution_best
problem6 = problem.copy()
problem6
param6 = deepcopy(param)
param6.rho_percent = 0.1
heuristic6 = Matheuristic(problem6,param6)
heuristic6.algo2()
heuristic6.plot_steps()
heuristic6.solution_best
problem = problemGITEGA
problem1 = problem.copy()
problem1
param
heuristic1 = Matheuristic(problem1,param)
heuristic1.algo2()
heuristic1.plot_steps()
heuristic1.solution_best
problem2 = problem.copy()
problem2.augment_v(2)
problem2
param
heuristic2 = Matheuristic(problem2,param)
heuristic2.algo2()
heuristic2.plot_steps()
heuristic2.solution_best
problem3 = problem.copy()
problem3.H = 2
problem3
param
heuristic3 = Matheuristic(problem3,param)
heuristic3.algo2()
heuristic3.plot_steps()
heuristic3.solution_best
problem4 = problem.copy()
problem4.t_virt = 0
problem4.time_fuse(1/problem.t_virt)
problem4
param
heuristic4 = Matheuristic(problem4,param)
heuristic4.algo2()
heuristic4.plot_steps()
heuristic4.solution_best
problem5 = problem.copy()
problem5
param5 = deepcopy(param)
param5.rho_percent = 0.6
heuristic5 = Matheuristic(problem5,param5)
heuristic5.algo2()
heuristic5.plot_steps()
heuristic5.solution_best
problem6 = problem.copy()
problem6
param6 = deepcopy(param)
param6.rho_percent = 0.1
heuristic6 = Matheuristic(problem6,param6)
heuristic6.algo2()
heuristic6.plot_steps()
heuristic6.solution_best
problem = problemBUJUMBURA
problem1 = problem.copy()
problem1
param
heuristic1 = Matheuristic(problem1,param)
heuristic1.algo2()
heuristic1.plot_steps()
heuristic1.solution_best
problem2 = problem.copy()
problem2.augment_v(2)
problem2
param
heuristic2 = Matheuristic(problem2,param)
heuristic2.algo2()
heuristic2.plot_steps()
heuristic2.solution_best
problem3 = problem.copy()
problem3.H = 2
problem3
param
heuristic3 = Matheuristic(problem3,param)
heuristic3.algo2()
heuristic3.plot_steps()
heuristic3.solution_best
problem4 = problem.copy()
problem4.t_virt = 0
problem4.time_fuse(1/problem.t_virt)
problem4
param
heuristic4 = Matheuristic(problem4,param)
heuristic4.algo2()
This problem was infeasible !
problem5 = problem.copy()
problem5
param5 = deepcopy(param)
param5.rho_percent = 0.6
heuristic5 = Matheuristic(problem5,param5)
heuristic5.algo2()
heuristic5.plot_steps()
heuristic5.solution_best
problem6 = problem.copy()
problem6
param6 = deepcopy(param)
param6.rho_percent = 0.1
heuristic6 = Matheuristic(problem6,param6)
heuristic6.algo2()
heuristic6.plot_steps()
heuristic6.solution_best